<?php
	session_start();
	set_time_limit(0);
	if (isset($_SESSION['auth']))
	{
		$fp = fsockopen( "127.0.0.1", 2332, $errno, $errstr, 5);
		while( $fp && !feof($fp) )
		{
			$max = ord(fread($fp,1));
			if ( $max > 0 )
			{
				file_put_contents( "chat.txt", fread($fp,$max)."\n", FILE_APPEND );
				flush();
				ob_flush();
			}
		}
	}
?>